package com.gloaba.common.log.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 操作人类别
 *
 * @author Oceania
 */
public enum OperatorType
{
    /**
     * 其它
     */
    OTHER("OTHER", "其它"),

    /**
     * 后台用户
     */
    MANAGE("MANAGE", "后台用户"),

    /**
     * 手机端用户
     */
    MOBILE("MOBILE", "手机端用户");

    /**
     * 类型
     */
    private final String type;

    /**
     * 说明
     */
    private final String remark;

    OperatorType(String type, String remark) {
        this.type = type;
        this.remark = remark;
    }

    public String getType() {
        return type;
    }

    public String getRemark() {
        return remark;
    }

    public static OperatorType getValue(String type) {
        if (StringUtils.isEmpty(type)) {
            return null;
        }
        for (OperatorType c : OperatorType.values()) {
            if (c.type.toLowerCase().equals(type.toLowerCase())) {
                return c;
            }
        }
        return OTHER;
    }
}
